<template>
    <!-- 套管选择弹窗 -->
    <el-dialog v-model="show" title=" 套管选择" width="700px" :close-on-click-modal="false" @close="modalClose" append-to-body>
        <div>
            <el-table :data="casingsList" height="350" style="width: 100%" highlight-current-row ref="singleTableRef"
                @current-change="handleCurrentChange">
                <el-table-column prop="casingId" label="套管ID" width="180" align="center" />
                <el-table-column prop="outerDiameter" label="外径" width="100" align="center" />
                <el-table-column prop="innerDiameter" label="内径" align="center" />
                <el-table-column prop="weight" label="重量" align="center" />
            </el-table>
        </div>
        <template #footer>
            <span class="dialog-footer">
                <el-button @click="show = false">取消</el-button>
                <el-button type="primary" @click="submit">绑定</el-button>
            </span>
        </template>
    </el-dialog>
</template>
  
<script setup name="CasingSelect">
import { queryList } from "@/api/tool/casing";
const { proxy } = getCurrentInstance();
const emit = defineEmits(["close"]);
const props = defineProps({
    show: {
        type: Boolean,
        default: false,
    },
});
const params = ref({ pageNum: 1, pageSize: 10, sortBy: 'id', searchKey: '' });
const id = ref();
const casingsList = ref([]);
function handleCurrentChange(selection) {
    console.log(selection)
}
//岗位提交
// function submit() {
//     if (props.user === undefined) {
//         postBind(postData.value).then((res) => {
//             proxy.$modal.msgSuccess("岗位绑定成功");
//             emit("close", 0);
//         });
//         console.log(props.user);
//     } else {
//         postData.value.userId = props.user.id;
//         const selection = postData.value.selection
//         postUpdate(postData.value).then((res) => {
//             proxy.$modal.msgSuccess(`岗位更改为${selection.postType}、${selection.postLevel}、${selection.postGrade}`);
//             emit("close", 0);
//         });
//     }
// }
function getCasingsList() {
    queryList(params.value).then((response) => {
        casingsList.value = response.content;
    });
}
function modalClose(e) {
    emit("close", 0);
}
getCasingsList()
</script>
  
<style></style>